﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using SDT.Model;
using SDT.Lib.Paging;
using System.Web.Mvc;
using SDT.Systems;
using SDT.Admin.Properties;

namespace SDT.Admin.ViewModels
{
    /// <summary>
    /// Author: Takamaru Nguyen
    /// Date: 01/07/2011
    /// </summary>
    public class ProjectViewModels
    {
        public ProjectViewModels()
        {
        }

        public IPagedList<Project> Projects;
        public TreeNodeCollection Categories = new TreeNodeCollection();
        public int CurrentCat;
        public int? CurrentPubStatus;
        public int? CurrentHotStatus;
        public string Keyword;
        public List<SelectListItem> ListStatusPub
        {
            get
            {
                List<SelectListItem> list = new CommonType().ToList();
                if (this.CurrentPubStatus.HasValue)
                    list.SingleOrDefault(i => int.Parse(i.Value) == this.CurrentPubStatus.Value).Selected = true;

                return list;
            }
        }
        // Added by Vietlv (13/09/2011)
        public List<SelectListItem> ListStatusHot
        { 
            get{
                List<SelectListItem> list = new StatusType().ToList();
                if (this.CurrentHotStatus.HasValue)
                    list.SingleOrDefault(e => int.Parse(e.Value) == this.CurrentHotStatus.Value).Selected = true;
                return list;
            }
        }
        public string ImageRootUrl;
    }

    /// <summary>
    /// Author: Takamaru Nguyen
    /// Date: 01/07/2011
    /// </summary>
    public class ProjectInputModels
    {
        public ProjectInputModels()
        {
        }

        public TreeNodeCollection Categories
        {
            get;
            set;
        }

        public List<SDT.Model.ProjectCompanyType> CompanyType
        {
            get;
            set;
        }

        public List<SelectListItem> ListCompany
        {
            get;
            set;
        }

        public List<SelectListItem> ListLegalStatus
        {
            get;
            set;
        }

        public List<SelectListItem> ListStatusPub
        {
            get
            {
                List<SelectListItem> list = new CommonType().ToList();
                if (this.CurrentPubStatus.HasValue)
                    list.SingleOrDefault(i => int.Parse(i.Value) == this.CurrentPubStatus.Value).Selected = true;

                return list;
            }
        }

        public List<SelectListItem> ListImageType
        {
            get;
            set;
        }

        public List<ProjectImage> ListProjectImage
        {
            get;
            set;
        }

		private List<SelectListItem> _listCity = new List<SelectListItem>();
		public List<SelectListItem> ListCity
		{
			get
			{
				return this._listCity;
			}
			set
			{
				if (value != null)
					this._listCity = value;
			}
		}

		private List<SelectListItem> _listDistrict = new List<SelectListItem>();
		public List<SelectListItem> ListDistrict
		{
			get
			{
				return this._listDistrict;
			}
			set
			{
				if (value != null)
					this._listDistrict = value;
			}
		}

        public Project Project
        {
            get;
            set;
        }

        public int? CurrentPubStatus
        {
            get;
            set;
        }

        public string CompanyTypeID
        {
            get
            {
                return "CompanyTypeID";
            }
        }

        private List<ProjectCompanyMap> _listProjectCompanyMap = new List<ProjectCompanyMap>();
        public List<ProjectCompanyMap> ListProjectCompanyMap
        {
            get
            {
                return this._listProjectCompanyMap;
            }
            set
            {
                if (value != null)
                    this._listProjectCompanyMap = value;
            }
        }

        [NonSerialized]
        public string ImageRootUrl;

        public string GoogleAPI
        {
            get
            {
                return Settings.Default.GoogleAPI;
            }
        }
        // Inserted by Vietlv(10/08/2011)
        public string CurrentListTag { get; set; }
        public List<Tag> Tags { get; set; }
        public List<int> ListTagID { get; set; }
    }
}
